<?php

  include_once './includes/bootstrap.inc';                                        
  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

  $result = db_query('SELECT * FROM {user_term_relation} LIMIT 100');

  while($row = db_fetch_object($result)) {
    $table_row[] = array($row->uid, $row->tid, $row->relation_type, format_date($row->created));
 
   db_query("INSERT INTO {flag_content} (fid, content_type, content_id, uid, timestamp) VALUES ('$row->relation_type', 'term',  '$row->tid', '$row->uid', '$row->created')");
   
  }
  

  
  print theme('table', NULL, $table_row);